fix(review): bind exact reviews to the leased PR head - #981
Conversation
85284ab to
12b5e4b
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 5:05 AM ET / 09:05 UTC. ClawSweeper reviewWhat this changesThis PR adds a tested TypeScript source guard that fetches and detached-checks out the leased pull-request head, skips review side effects when the source has moved, and materializes sibling Codex source for OpenClaw review jobs. Merge readinessKeep this PR open for maintainer integration. The proposed guard makes the leased PR SHA authoritative before review work begins, and the supplied proof plus focused source inspection support the design; however, GitHub reports the branch as dirty against current Priority: P2 Review scores
Verification
How this fits togetherThe exact-review workflow leases a specific GitHub item revision, prepares a target repository checkout, then runs Codex review and durable artifact/ledger publication. This change sits between checkout and review so every downstream result is tied to the leased pull-request head or safely requeued when that head moved. flowchart LR
Queue[Exact review queue] --> Lease[Leased PR head]
Lease --> Checkout[Target repository checkout]
Checkout --> Guard[Exact source guard]
Guard -->|Leased head matches| Review[Codex review]
Guard -->|Source drift| Requeue[Requeue latest source]
Review --> Finalize[Artifact and ledger finalization]
Decision needed
Why: The intended guard is sound, but the dirty merge requires choosing and validating the combined workflow semantics; automated cleanup must not resolve a repository-member PR or decide which newer lifecycle protections remain authoritative. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Rebase the PR onto current Do we have a high-confidence way to reproduce the issue? Yes. The proposed real-Git fixture supplies a high-confidence path for a lease/head mismatch: move Is this the best way to solve the issue? Yes, conditionally. Moving leased-head materialization into a focused TypeScript command is a more testable boundary than workflow shell logic, but it must be rebased so the final workflow retains all current exact-review safeguards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2d1a40bfa643. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (19 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
302b879 to
813167f
Compare
What Problem This Solves
Fixes an issue where exact pull request reviews could claim one immutable head SHA while reviewing the target branch checkout instead, and OpenClaw reviews could run without the required sibling Codex source.
Why This Change Was Made
Exact PR runs now delegate leased-head fetch, validation, and detached checkout to a testable TypeScript command. A moved head returns a structured
source_driftresult that skips review, artifact creation, and lease cleanup while the durable queue requeues the latest source. OpenClaw review workers also materializeopenai/codexbeside the target checkout.User Impact
Maintainers can trust that an exact ClawSweeper verdict applies to the SHA named by its queue lease and that Codex-backed OpenClaw contract checks have the required dependency source. There is no new configuration.
Evidence
302b879791f77c94305190d1e8ce730421209497(signed).pnpm run build:repairpassed.node --test test/repair/exact-review-source.test.ts test/sweep-workflow.test.ts: 107/107 passed, including matching head, source drift, unfetchable ref, and a shallow divergent-history fixture with a 75-commit PR plus 60 newer base commits.git diff --check: clean.pnpm run check: build, format, lint, coverage thresholds, and 2,847 tests passed; five unchanged Linux Landlock fixture tests cannot import on macOS because Apple libc has nocapset. Exact-head Linux CI is the authoritative remaining gate.Real Behavior Proof
source_driftwithout changing the target checkout; missing refs fail closed. A shallow target whose base advanced 60 commits and whose PR contains 75 commits is fully unshallowed, preserves the original merge base, and exposes all 75 PR commits toorigin/main..HEAD. Parsed workflow coverage proves source drift skips reservation, review, ledger finalization, artifact bundling, and unsuccessful lease release while exportingrequeue_latest=true.ClawSweeper Finding Disposition - July 31, 2026
repair:exact-review-source; workflow YAML now only clones the target, invokes the command, and branches on structured outputs.requeue_latest=true; fetch failure remains a hard failure rather than a false requeue.origin/mainAGENTS.mdreserves the OpenClaw target repository'sCHANGELOG.mdduring foreign PR work;CONTRIBUTING.mdexplicitly says ClawSweeper follows its own release-note policy. This PR changes ClawSweeper itself, and the operationally meaningful exact-review change therefore keeps its ClawSweeper changelog entry.pnpm check, CodeQL, containment smoke, sparse repair build, Windows launcher, and production automerge E2E are green.